package org.snail.employee.bean;

import lombok.Data;
import lombok.ToString;
import lombok.extern.log4j.Log4j;
import org.snail.base.BaseParam;
import org.snail.excel.annotation.ExcelBean;
import org.snail.excel.annotation.ExcelColumn;
import org.springframework.util.StringUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

@Data
@ToString
@ExcelBean
@Log4j
public class EmployeesBaseDO implements Serializable{
    //主表id
    private Integer id;
    //副表id
    private Integer viceId;
    //入职日期
    @ExcelColumn(name = "entryDate", position = 0, columnName = "入职日期")
    private Date entryDate;
    //上项日期
    @ExcelColumn(name = "projectOnlineDate", position = 1, columnName = "上项日期")
    private Date projectOnlineDate;
    //下项日期
    @ExcelColumn(name = "projectOfflineDate", position = 2, columnName = "下项日期")
    private Date projectOfflineDate;
    //离职日期
    @ExcelColumn(name = "departureDate", position = 3, columnName = "离职日期")
    private Date departureDate;
    //状态
    @ExcelColumn(name = "state", position = 4, columnName = "状态")
    private Integer state;
    //详细状态
    @ExcelColumn(name = "stateDetail", position = 5, columnName = "详细状态")
    private String stateDetail;
    //姓名
    @ExcelColumn(name = "name", position = 6, columnName = "姓名")
    private String name;
    //工号
    @ExcelColumn(name = "workNum", position = 7, columnName = "工号")
    private String workNum;
    //性别
    @ExcelColumn(name = "sex", position = 8, columnName = "性别")
    private String sex;
    //学历
    @ExcelColumn(name = "education", position = 9, columnName = "学历")
    private String education;
    //年龄
    @ExcelColumn(name = "age", position = 10, columnName = "年龄")
    private Integer age;
    //技能
    @ExcelColumn(name = "skill", position = 11, columnName = "技能")
    private String skill;
    //级别
    @ExcelColumn(name = "level", position = 12, columnName = "级别")
    private String level;
    //最新薪资
    @ExcelColumn(name = "latestSalary", position = 13, columnName = "最新薪资")
    private Double latestSalary;
    //转正薪资
    @ExcelColumn(name = "positiveSalary", position = 14, columnName = "转正薪资")
    private Double positiveSalary;
    //试用薪资
    @ExcelColumn(name = "trialSalary", position = 15, columnName = "试用薪资")
    private Double trialSalary;
    //试用
    @ExcelColumn(name = "trial", position = 16, columnName = "试用")
    private Integer trial;
    //一级项目
    @ExcelColumn(name = "oneLevelPro", position = 17, columnName = "一级项目")
    private String oneLevelPro;
    private String dingId;
    private Long departmentId;
    private int isDel;    //是否删除
    private Date createTime;   //创建时间
    private  String createBy;   //创建人
    private Date updateTime;   //修改时间
    private String updateBy;     //修改人
    private String outNum;     //修改人


    @Override
    public boolean equals(Object object) {
        if (this == object) return true;
        if (!(object instanceof EmployeesBaseDO)) return false;
        if (!super.equals(object)) return false;
        EmployeesBaseDO that = (EmployeesBaseDO) object;
        return Objects.equals(id, that.id) && Objects.equals(viceId, that.viceId) && Objects.equals(entryDate, that.entryDate) && Objects.equals(projectOnlineDate, that.projectOnlineDate) && Objects.equals(projectOfflineDate, that.projectOfflineDate) && Objects.equals(departureDate, that.departureDate) && Objects.equals(state, that.state) && Objects.equals(stateDetail, that.stateDetail) && Objects.equals(name, that.name) && Objects.equals(workNum, that.workNum) && Objects.equals(sex, that.sex) && Objects.equals(education, that.education) && Objects.equals(age, that.age) && Objects.equals(skill, that.skill) && Objects.equals(level, that.level) && Objects.equals(latestSalary, that.latestSalary) && Objects.equals(positiveSalary, that.positiveSalary) && Objects.equals(trialSalary, that.trialSalary) && Objects.equals(trial, that.trial) && Objects.equals(oneLevelPro, that.oneLevelPro);
    }

    @Override
    public int hashCode() {
        String workNum = this.workNum;
        if (StringUtils.isEmpty(workNum)){
            log.error("人员基础表没有找到员工工号!");
            return -1;
        }
        return workNum.hashCode();
    }


}